home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / alib / alib.doc < prev    next >
Text File  |  1991-08-23  |  12KB  |  713 lines

  1. ;;    abort if cf
  2. ;
  3. ;    entry    Cf    error flag, program exits if set (Cf==1)
  4.  
  5. ;;    add atom
  6. ;
  7. ;    entry    DS:SI    string to hash
  8. ;    exit    AX    atom index
  9. ;        Cf    if table full
  10.  
  11. ;;    add binary atom
  12. ;
  13. ;    entry    DS:SI    bytes to hash
  14. ;        CX    byte count (<256)
  15. ;    exit    AX    atom index
  16. ;        Cf    if table full or atom too big
  17.  
  18. ;;    block alloc
  19. ;
  20. ;    exit    AX    block size in bytes
  21. ;        BX    block handle
  22. ;        ES:DI    block pointer
  23. ;        Cf    if no memory
  24.  
  25. ;;    block file open
  26. ;
  27. ;    entry    DS:SI    file name
  28. ;    exit    AX    file size in blocks
  29. ;        BX    block handle
  30. ;        Cf    if file not found or empty
  31.  
  32. ;;    block file read
  33. ;
  34. ;    entry    AX    16k file block number (0..n)
  35. ;        BX    block index
  36. ;    exit    DS:SI    block pointer
  37. ;        AX    block size (<16k if last block)
  38. ;        Cf    if bad block index or past end of file
  39.  
  40. ;;    block free
  41. ;
  42. ;    entry    BX    block index
  43. ;    exit    Cf    if bad index (cannot free file blocks)
  44. ;    uses    AX,BX
  45.  
  46. ;;    block read
  47. ;
  48. ;    entry    BX    block index
  49. ;    exit    AX    block size
  50. ;        DS:SI    block pointer
  51. ;        Cf    if bad block or no memory
  52.  
  53. ;;    calloc
  54. ;
  55. ;    entry    CX    requested byte count (1..FFF0)
  56. ;    exit    AX    actual byte count
  57. ;        ES:DI    storage pointer
  58. ;        Cf    if no storage
  59.  
  60. ;;    check block file
  61. ;
  62. ;    entry    DS:SI    file name
  63. ;    exit    BX    file id or 0 if unknown file
  64.  
  65. ;;    clear ncb
  66. ;
  67. ;    entry    DS:SI    ncb ptr
  68.  
  69. ;;    clear strerror
  70. ;
  71. ;    zeros error string pointer
  72.  
  73. ;;    close file
  74. ;
  75. ;    entry    BX    handle
  76. ;    exit    Cf    if error
  77. ;    uses    AX
  78.  
  79. ;;    close file cf
  80. ;
  81. ;    entry    BX    handle
  82. ;        Cf    error flag
  83. ;    exit    Cf    if error flag set on entry or error during close file
  84. ;    uses    AX
  85.  
  86. ;;    current file size
  87. ;
  88. ;    entry    BX    file handle
  89. ;    exit    DX AX    file size
  90. ;        Cf    if unexpected file error
  91.  
  92. ;;    dialog error beta
  93. ;
  94. ;    entry    AX    DGROUP error string
  95. ;    exit    Cf    1
  96. ;    uses    AX
  97.  
  98. ;;    dialog strerror beta
  99. ;
  100. ;    exit    Cf    1
  101. ;    uses    AX
  102.  
  103. ;;    disable exit intercept
  104. ;
  105. ;    uses    AX,SI,DS
  106.  
  107. ;;    ems exchange
  108. ;
  109. ;    entry    AX    page index (1..n)
  110. ;        ES:DI    destination
  111. ;    exit    Cf    if bad block or EMS error
  112. ;    uses    AX
  113.  
  114. ;;    ems in
  115. ;
  116. ;    entry    AX    block index (1..n)
  117. ;        ES:DI    destination (no transfer if NULL)
  118. ;    exit    Cf    if bad block or EMS error
  119. ;    uses    AX
  120.  
  121. ;;    ems out
  122. ;
  123. ;    entry    ES:DI    source
  124. ;    exit    AX    block index (1..n)
  125. ;        Cf    if EMS full or EMS error
  126.  
  127. ;;    enable exit intercept
  128. ;
  129. ;    uses    AX,SI,DS
  130.  
  131. ;;    err disk full
  132. ;
  133. ;    exit    Cf    1
  134. ;    uses    AX
  135.  
  136. ;;    exit
  137. ;
  138. ;    entry    AL    exit code
  139.  
  140. ;;    exit with failure
  141.  
  142. ;;    exit with success
  143.  
  144. ;;    fatal app exit
  145. ;
  146. ;    entry    AX    offset of DGROUP error string
  147. ;    note        this function never returns
  148.  
  149. ;;    fclose
  150. ;
  151. ;    entry    BX    stream handle
  152. ;    exit    Cf    if error closing file or bad handle
  153. ;    uses    AX,BX
  154.  
  155. ;;    find atom
  156. ;
  157. ;    entry    DS:SI    string to find
  158. ;    exit    AX    atom index
  159. ;        Cf    if not found
  160.  
  161. ;;    find binary atom
  162. ;
  163. ;    entry    DS:SI    bytes to hash
  164. ;        CX    byte count (<256)
  165. ;    exit    AX    atom index (or 0)
  166. ;        Cf    if not found
  167.  
  168. ;;    fopen
  169. ;
  170. ;    entry    AX    mode, 'r' or 'w' to open for reading or writing
  171. ;        DS:SI    filename
  172. ;    exit    BX    stream handle
  173. ;        Cf    if error
  174. ;    uses    AX
  175.  
  176. ;;    fread
  177. ;
  178. ;    entry    BX    stream handle
  179. ;        CX    byte count
  180. ;        ES:DI    destination pointer
  181. ;    exit    AX    actual byte count (!=CX for EOF)
  182. ;        DI    updated
  183. ;        Cf    if error
  184.  
  185. ;;    free
  186. ;
  187. ;    entry    ES:DI    storage pointer (OK if NULL)
  188. ;    exit    ES:DI    NULL
  189. ;        Cf    if bad pointer
  190. ;    uses    AX
  191.  
  192. ;;    fwrite
  193. ;
  194. ;    entry    BX    stream handle
  195. ;        CX    byte count
  196. ;        DS:SI    source pointer
  197. ;    exit    AX    bytes written
  198. ;        SI    updated
  199. ;        Cf    if error
  200.  
  201. ;;    get atom name
  202. ;
  203. ;    entry    AX    atom index
  204. ;        CX    buffer size
  205. ;        ES:DI    output buffer
  206. ;    exit    DI    updated (points to \0)
  207. ;        CX    updated
  208. ;        Cf    if bad atom index
  209. ;    uses    AX
  210.  
  211. ;;    get input state
  212. ;
  213. ;    exit    Zf    if no key waiting
  214. ;    uses    AX
  215. ;    note    returns TRUE for keyboard, mouse, and timer under Windows
  216.  
  217. ;;    get strerror
  218. ;
  219. ;    exit    DS:SI    error string
  220. ;        Zf    if no error string
  221.  
  222. ;;    get vector
  223. ;
  224. ;    entry    AL    vector #
  225. ;    exit    DS:SI    selected vector
  226. ;        Zf    if null vector
  227. ;    uses    AX
  228.  
  229. ;;    global alloc
  230. ;
  231. ;    entry    CX    requested size
  232. ;    exit    AX    actual size
  233. ;        BX    storage handle (never zero)
  234. ;        Cf    if no storage
  235.  
  236. ;;    global calloc
  237. ;
  238. ;    entry    CX    requested size
  239. ;    exit    AX    actual size
  240. ;        BX    storage handle (never zero)
  241. ;        Cf    if no storage
  242.  
  243. ;;    global free
  244. ;
  245. ;    entry    BX    storage handle (OK if zero)
  246. ;    exit    BX    0
  247. ;    uses    AX
  248.  
  249. ;;    global lock
  250. ;
  251. ;    entry    BX    valid storage handle
  252. ;    exit    DS:SI    storage pointer
  253. ;    note        DOES NOT BASH AX
  254.  
  255. ;;    global realloc
  256. ;
  257. ;    entry    BX    storage handle
  258. ;        CX    new size
  259. ;    exit    AX    actual size (if no errors)
  260. ;        Cf    if not enough memory
  261.  
  262. ;;    global unlock
  263. ;
  264. ;    entry    BX    valid storage handle
  265. ;    note        flags do NOT change
  266.  
  267. ;;    init atom table
  268. ;
  269. ;    entry    AX    prime number approximate twice maximum atom count
  270. ;    exit    Cf    if no memory
  271. ;    uses    AX
  272.  
  273. ;;    input file size
  274. ;
  275. ;    entry    BX    file handle
  276. ;    exit    DX AX    size
  277.  
  278. ;;    isalnum
  279. ;
  280. ;    entry    AL    character
  281. ;    exit    Zf    if alphanumeric character
  282.  
  283. ;;    isalpha
  284. ;
  285. ;    entry    AL    character
  286. ;    exit    Zf    if AL==A-Za-z
  287.  
  288. ;;    isalpha_
  289. ;
  290. ;    entry    AL    character
  291. ;    exit    Zf    if AL alphabetic or _ but not number
  292.  
  293. ;;    iscntrl
  294. ;
  295. ;    entry    AL    character
  296. ;    exit    Zf    if control character (0x7F or 0x00..0x1F)
  297.  
  298. ;;    isdigit
  299. ;
  300. ;    entry    AL    char
  301. ;    exit    Zf    if 0..9
  302.  
  303. ;;    isgraph
  304. ;
  305. ;    entry    AL    character
  306. ;    exit    Zf    if printable character (not space)
  307.  
  308. ;;    islower
  309. ;
  310. ;    entry    AL    character
  311. ;    exit    Zf    if a..z
  312.  
  313. ;;    isprint
  314. ;
  315. ;    entry    AL    character
  316. ;    exit    Zf    if printable character (including space)
  317.  
  318. ;;    ispunct
  319. ;
  320. ;    entry    AL    character
  321. ;    exit    Zf    if !"#%&'();<=>?[\]*+,-./:^_{|}~
  322.  
  323. ;;    isspace
  324. ;
  325. ;    entry    AL    character
  326. ;    exit    Zf    if space, FF, NL, CR, HT, or VT
  327.  
  328. ;;    isupper
  329. ;
  330. ;    entry    AL    character
  331. ;    exit    Zf    if A..Z
  332.  
  333. ;;    isxdigit
  334. ;
  335. ;    entry    AL    character
  336. ;    exit    Zf    if 0..9 A..F a..f
  337.  
  338. ;;    malloc
  339. ;
  340. ;    entry    CX    requested byte count (1..FFF0)
  341. ;    exit    AX    actual byte count
  342. ;        ES:DI    storage pointer (unchanged if error)
  343. ;        Cf    if no storage
  344.  
  345. ;;    move file pointer
  346. ;
  347. ;    entry    BX    file handle
  348. ;        DX AX    file position
  349. ;    exit    Cf    if error
  350. ;    uses    AX
  351.  
  352. ;;    ms dos
  353.  
  354. ;;    ms dos dialog
  355. ;
  356. ;    entry    *    according to dos function
  357. ;    exit    *
  358. ;    uses    *
  359. ;    note    displays dialog box when ms_dos returns an error
  360.  
  361. ;;    ms dos strerror
  362.  
  363. ;;    netbios add name
  364. ;
  365. ;    entry    DS:SI    asciiz name (less than 16 characters long)
  366. ;    exit    Cf    if error
  367. ;        AL    name number (or return code if error)
  368.  
  369. ;;    netbios call
  370. ;
  371. ;    entry    DS:SI    netbios control block
  372. ;    exit    AX    return code (0xFF if function pending)
  373. ;        Cf    if error
  374.  
  375. ;;    netbios cancel
  376. ;
  377. ;    entry    DS:SI    netbios command block
  378. ;    exit    AX    final return code
  379. ;        Cf    if error
  380.  
  381. ;;    netbios check
  382. ;
  383. ;    exit    Cf    if no netbios driver
  384. ;    uses    AX,SI
  385.  
  386. ;;    netbios delete name
  387. ;
  388. ;    entry    DS:SI    asciiz name (less than 16 characters long)
  389. ;    exit    Cf    if error
  390. ;        AL    return code
  391.  
  392. ;;    netbios hang up
  393. ;
  394. ;    entry    AL    session number
  395. ;    exit    AL    return code
  396. ;        Cf    if error
  397.  
  398. ;;    netbios receive wait
  399. ;
  400. ;    entry    AL    local session number
  401. ;        CX    buffer length
  402. ;        ES:DI    buffer pointer
  403. ;    exit    AL    return code
  404. ;        CX    bytes received (0 if session closed or error)
  405. ;        Cf    if error (session closed is not an error)
  406.  
  407. ;;    netbios send broadcast
  408. ;
  409. ;    entry    AL    add name number
  410. ;        CX    buffer length
  411. ;        ES:DI    buffer
  412. ;    exit    AL    return code
  413. ;        Cf    if error
  414. ;    note    waits until datagram sent over network
  415.  
  416. ;;    netbios send datagram
  417. ;
  418. ;    entry    AL    add name number
  419. ;        CX    buffer length
  420. ;        ES:DI    buffer
  421. ;        DS:SI    asciiz call name (destination)
  422. ;    exit    AL    return code
  423. ;        Cf    if error
  424. ;    note    waits until datagram sent over network
  425.  
  426. ;;    netbios send wait
  427. ;
  428. ;    entry    AL    session number
  429. ;        CX    length
  430. ;        ES:DI    buffer pointer
  431. ;    exit    AL    return code
  432. ;        Cf    if error
  433.  
  434. ;;    open block file
  435. ;
  436. ;    entry    DS:SI    file name
  437. ;    exit    CX    file size in 16k blocks
  438. ;        DX    file id (1..n)
  439. ;        Cf    if file not found or no storage
  440. ;    uses    AX
  441.  
  442. ;;    open input file
  443. ;
  444. ;    entry    DS:SI    string
  445. ;    exit    AX,BX    handle
  446. ;        Cf    if error, error text set
  447. ;    calls    offset_dos_error, ms_dos
  448.  
  449. ;;    open output file
  450. ;
  451. ;    entry    DS:SI    string
  452. ;    exit    AX,BX    handle
  453. ;        Cf    if error, error text set
  454. ;    calls    offset_dos_error, ms_dos
  455.  
  456. ;;    perror
  457. ;
  458. ;    entry    DS:SI    optional message prefix
  459. ;    uses    AX
  460.  
  461. ;;    put hex byte
  462. ;
  463. ;    entry    AL    byte
  464. ;    uses    AX
  465. ;    note    calls putchar to write chrs
  466.  
  467. ;;    put hex word
  468. ;
  469. ;    entry    AX    word
  470. ;    uses    AX
  471.  
  472. ;;    put multiple bytes
  473. ;
  474. ;    entry    CX    byte count
  475. ;        DS:SI    byte pointer
  476. ;    uses    AX,CX,SI
  477.  
  478. ;;    put netbios name
  479. ;
  480. ;    entry    DS:SI    name field of control block
  481. ;    uses    AX,SI
  482.  
  483. ;;    put string
  484. ;
  485. ;    entry    DS:SI    asciiz string
  486. ;    uses    AX
  487.  
  488. ;;    put unsigned
  489. ;
  490. ;    entry    AX    number
  491. ;    uses    AX
  492.  
  493. ;;    putchar
  494. ;
  495. ;    entry    AL    character
  496.  
  497. ;;    putchar newline
  498. ;
  499. ;    uses    AX
  500.  
  501. ;;    putchar space
  502. ;
  503. ;    uses    AX
  504.  
  505. ;;    puts
  506. ;
  507. ;    entry    DS:SI    asciiz string
  508. ;    uses    AX
  509.  
  510. ;;    puts dgroup
  511. ;
  512. ;    entry    AX    DGROUP string pointer
  513. ;    uses    AX
  514.  
  515. ;;    rand
  516. ;
  517. ;    exit    AX    random number
  518.  
  519. ;;    random
  520. ;
  521. ;    entry    AX    num
  522. ;    exit    AX    random number between 0 and num-1
  523.  
  524. ;;    read block file
  525. ;
  526. ;    entry    AX    file block index (0..n)
  527. ;        BX    file id (1..n)
  528. ;        ES:DI    transfer address
  529. ;    exit    AX    byte count
  530. ;        Cf    if error
  531.  
  532. ;;    read command line
  533. ;
  534. ;    exit    DS:SI    program command line
  535.  
  536. ;;    read entire file
  537. ;
  538. ;    entry    DS:SI    asciiz file name
  539. ;    exit    DS:SI    ptr to storage containing file (NULL delimited)
  540. ;        CX    file byte count
  541. ;        Cf    if file not found or too big
  542. ;    uses    AX
  543.  
  544. ;;    read environment
  545. ;
  546. ;    exit    DS:SI    environment
  547.  
  548. ;;    read from file
  549. ;
  550. ;    entry    BX    file handle
  551. ;        CX    byte count
  552. ;        ES:DI    destination
  553. ;    exit    AX    number of bytes read
  554. ;        Cf    if error
  555.  
  556. ;;    realloc
  557. ;
  558. ;    entry    CX    requested byte count (1..FFF0)
  559. ;        ES:DI    storage pointer
  560. ;    exit    AX    actual byte count
  561. ;        Cf    if not enough memory or cannot increase size
  562.  
  563. ;;    remove
  564. ;
  565. ;    entry    DS:SI    filename to delete
  566. ;    exit    Cf    if error
  567. ;    uses    AX
  568.  
  569. ;;    rename
  570. ;
  571. ;    entry    DS:SI    old name
  572. ;        ES:DI    new name
  573. ;    exit    Cf    if error
  574. ;    uses    AX
  575.  
  576. ;;    rewind
  577. ;
  578. ;    entry    BX    file handle
  579. ;    exit    Cf    if error
  580. ;    uses    AX
  581.  
  582. ;;    save most
  583. ;
  584. ;    note    saves all registers except AX and BP.  however, the current
  585. ;        version also saves BP because the code works out that way.
  586. ;        the registers are automatically restored.  this routine is
  587. ;        called with a return address as the top of stack.
  588.  
  589. ;;    select min count
  590. ;
  591. ;    entry    CX    count1
  592. ;        DX AX    count2
  593. ;    exit    CX    minimum of count1 and count2
  594.  
  595. ;;    set argc argv
  596. ;
  597. ;    exit    Cf    if no memory
  598. ;    uses    AX,CX,DI,SI,ES,DS
  599.  
  600. ;;    set block handle
  601. ;
  602. ;    entry    BX    block handle
  603. ;        DX    file id
  604. ;    exit    Cf    if bad file id
  605. ;    uses    AX,CX,SI,DS
  606.  
  607. ;;    set strerror
  608. ;
  609. ;    entry    AX    DGROUP offset of asciiz error string
  610. ;    exit    Cf    1
  611.  
  612. ;;    startup
  613. ;
  614. ;    entry    AX    offset stack
  615. ;        ES    program segment prefix
  616. ;        SS    DGROUP
  617. ;    exit    BP    0
  618. ;    may use    AX,BX,CX,DX,DI,SI,DS,ES
  619.  
  620. ;;    strcmpi
  621. ;
  622. ;    entry    DS:SI    string1
  623. ;        ES:DI    string2
  624. ;    exit    Zf    if string1==string2
  625. ;    uses    AX
  626.  
  627. ;;    strcpy
  628. ;
  629. ;    entry    DS:SI    source ptr
  630. ;        ES:DI    destination ptr
  631. ;    exit    SI    updated past NULL
  632. ;        DI    updated, points to NULL
  633. ;    uses    AX
  634.  
  635. ;;    strcpy limit
  636. ;
  637. ;    entry    DS:SI    source pointer
  638. ;        ES:DI    destination pointer
  639. ;        DX    destination limit
  640. ;    exit    DI    updated to last character in destination
  641. ;    uses    AX
  642.  
  643. ;;    strlen
  644. ;
  645. ;    entry    DS:SI    string
  646. ;    exit    CX    byte count excluding NULL
  647. ;    uses    AX
  648.  
  649. ;;    strlenz
  650. ;
  651. ;    entry    DS:SI    string
  652. ;    exit    CX    byte count including NULL
  653. ;    uses    AX
  654.  
  655. ;;    strncpy
  656. ;
  657. ;    entry    DS:SI    source string
  658. ;        ES:DI    destination buffer
  659. ;        CX    byte count (includes room for \0)
  660. ;    exit    SI    updated (past \0 unless CX too small)
  661. ;        DI    updated (points to \0)
  662. ;        CX    updated
  663. ;    uses    AX
  664.  
  665. ;;    strskp
  666. ;
  667. ;    entry    DS:SI    asciiz string ptr
  668. ;    exit    SI    updated past null
  669. ;    uses    AX
  670.  
  671. ;;    strskp line
  672. ;
  673. ;    entry    DS:SI    string pointer
  674. ;    exit    SI    updated to next line but not past \0
  675. ;        AL    delimiting char (either 0 or 0Ah)
  676.  
  677. ;;    strskp white
  678. ;
  679. ;    entry    DS:SI    text ptr
  680. ;    exit    SI    updated past spaces and tabs
  681. ;        AL    non-white character
  682.  
  683. ;;    swap in
  684. ;
  685. ;    entry    AX    swap index
  686. ;        ES:DI    destination (no disk I/O if NULL)
  687. ;    exit    Cf    if error
  688. ;    uses    AX
  689.  
  690. ;;    swap out
  691. ;
  692. ;    entry    ES:DI    source pointer
  693. ;    exit    AX    swap index (1..MAX) or 0 if error
  694. ;        Cf    if error (full disk or swap file, not DOS 3+)
  695.  
  696. ;;    tolower
  697. ;
  698. ;    entry    AL    char
  699. ;    exit    AL    lower cased AL
  700.  
  701. ;;    toupper
  702. ;
  703. ;    entry    AL    char
  704. ;    exit    AL    upper cased AL
  705.  
  706. ;;    write to file
  707. ;
  708. ;    entry    BX    file handle
  709. ;        CX    byte count
  710. ;        ES:DI    buffer
  711. ;    exit    Cf    if error
  712.  
  713.